package com.feng.service.impl.impl;

import com.feng.bean.UserAddress;
import com.feng.service.impl.OrderService;
import com.feng.service.impl.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Service spring的服务注解.需要在配置文件中,主动开启扫描包的范围
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    UserService userService;

    /**
     * 调用远程的服务来查询信息
     * 使用的是远程的服务.
     * @param id
     * @return
     */
    public List<UserAddress> initOrder(String id) {
        List<UserAddress> userAddress = userService.getUserAddress(id);
        for (int i = 0; i < userAddress.size(); i++) {
            System.out.println(userAddress.get(i).toString());
        }
        return userAddress;
    }
}
